can vectorize this for-loop with update variable in each iterate

welcome to shbcf.ru